﻿@model BusinessLogic.DTO.AccountDTO

@{
    Layout = "~/Views/Shared/_adminLayout.cshtml";
    ViewBag.Title = "Register";
}

<h2>Create a New Account</h2>
<p>
    Use the form below to create a new account. 
</p>
<p>
    Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length.
</p>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true, "Błąd tworzeni kont, popraw formularz.")
    <div>
        <fieldset>
            <legend>Account Information</legend>

            <div class="editor-label">
                @Html.LabelFor(m => m.User.Username)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Username)
                @Html.ValidationMessageFor(m => m.User.Username)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.User.Email)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.User.Email)
                @Html.ValidationMessageFor(m => m.User.Email)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.User.Password)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.User.Password)
                @Html.ValidationMessageFor(m => m.User.Password)
            </div>

            <div class="editor-label">
                @Html.Label("Role")
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(lb => lb.Role,Model.Roles.Select(role => new SelectListItem{Text = role.RoleName,Value = role.RoleName}))
            </div>

            <p>
                <input type="submit" value="Register" />
            </p>
        </fieldset>
    </div>
}
